package com.bk.bands.template.xmladapter;

import javax.xml.bind.annotation.adapters.XmlAdapter;

import com.bk.bands.common.Color;
import com.bk.bands.template.xmladapter.util.ColorUtil;

/**
 * Created by IntelliJ IDEA.
 * User: SG0891787
 * Date: 3/7/12
 * Time: 12:12 AM
 */
public class ColorAdapter extends XmlAdapter<String, Color>
{
    public Color unmarshal(String val) throws Exception
    {
      return ColorUtil.decodeHtmlColorString(val);
    }

    public String marshal(Color val) throws Exception
    {
      return '#' + Integer.toHexString(val.getRGB());
    }
}
